<?php

use yii\db\Migration;

class m170302_020715_update_oldrecords extends Migration
{
    /*数据库表更改了一堆，要将之前的旧数据记录也更新到和当前新结构统一的数据*/
    public function safeUp()
    {
        $this->update("{{%apply}}",['mode'=>1],['mode'=>0,'site_id'=>[8,9]]);
        $this->update("{{%login_auth}}",['mode'=>1],['mode'=>0,'web_site_id'=>21]);
        $this->update("{{%customer_dues}}",['mode'=>1],['mode'=>0,'site_id'=>[8,9]]);
    }

    public function safeDown()
    {
        echo "m170302_020715_update_oldrecords cannot be reverted.\n";

        return false;
    }
}
